package com.xbe.visibility.service.impl;

import com.xbe.common.core.text.Convert;
import com.xbe.common.utils.DateUtils;
import com.xbe.visibility.domain.Visibility;
import com.xbe.visibility.mapper.VisibilityMapper;
import com.xbe.visibility.service.IVisibilityService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 能见度Service业务层处理
 *
 * @author ruoyi
 * @date 2020-08-13
 */
@Service
public class VisibilityServiceImpl implements IVisibilityService
{
    @Autowired
    private VisibilityMapper visibilityMapper;

    /**
     * 查询能见度
     *
     * @param id 能见度ID
     * @return 能见度
     */
    @Override
    public Visibility selectVisibilityById(Long id)
    {
        return visibilityMapper.selectVisibilityById(id);
    }

    /**
     * 查询能见度列表
     *
     * @return 能见度
     */
    @Override
    public List<Visibility> selectVisibilityList(String startTime, String endTime, String sim)
    {
        return visibilityMapper.selectVisibilityList(startTime, endTime, sim);
    }

    /**
     * 新增能见度
     *
     * @param visibility 能见度
     * @return 结果
     */
    @Override
    public int insertVisibility(Visibility visibility)
    {
        visibility.setCreateTime(DateUtils.getNowDate());
        return visibilityMapper.insertVisibility(visibility);
    }

    /**
     * 修改能见度
     *
     * @param visibility 能见度
     * @return 结果
     */
    @Override
    public int updateVisibility(Visibility visibility)
    {
        return visibilityMapper.updateVisibility(visibility);
    }

    /**
     * 删除能见度对象
     *
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteVisibilityByIds(String ids)
    {
        return visibilityMapper.deleteVisibilityByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除能见度信息
     *
     * @param id 能见度ID
     * @return 结果
     */
    @Override
    public int deleteVisibilityById(Long id)
    {
        return visibilityMapper.deleteVisibilityById(id);
    }

    @Override
    public void removeData(Integer days)
    {
        visibilityMapper.removeData(days);
    }
}
